﻿using BCEntity.Sim.Admin.AdminPermissionConfig;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Sim.Admin.AdminPermissionConfig
{
    /// <summary>
    /// 员工权限配置
    /// </summary>
    public interface IAdminPermissionConfigData
    {
        /// <summary>
        /// 检查员工权限是否存在
        /// </summary>
        /// <param name="adminPermissionConfigId">员工权限Id</param>
        /// <returns></returns>
        Task<bool> CheckExists(long adminPermissionConfigId);
        /// <summary>
        /// 检查员工权限是否存在
        /// </summary>
        /// <param name="permissionCode">权限码</param>
        /// <param name="permissionPathCode">权限码路径</param>
        /// <returns></returns>
        Task<bool> CheckExists(string permissionCode, string permissionPathCode = null);
        /// <summary>
        /// 添加员工权限
        /// </summary>
        /// <param name="entity">员工权限</param>
        /// <returns></returns>
        Task<AdminPermissionConfigEntity> Add(AdminPermissionConfigEntity entity);
        /// <summary>
        /// 更新员工权限
        /// </summary>
        /// <param name="entity">员工权限</param>
        /// <param name="adminPermissionMappingPageIds">员工权限与页面映射Ids</param>
        /// <param name="adminPermissionRecordIds">员工权限配置记录Ids</param>
        /// <returns></returns>
        Task<bool> Update(AdminPermissionConfigEntity entity, List<int> adminPermissionMappingPageIds, List<long> adminPermissionRecordIds);
        /// <summary>
        /// 删除员工权限
        /// </summary>
        /// <param name="adminPermissionConfigId">员工权限Id</param>
        /// <returns></returns>
        void Delete(long adminPermissionConfigId);
        /// <summary>
        /// 获取员工权限
        /// </summary>
        /// <param name="adminPermissionConfigId">员工权限Id</param>
        /// <returns></returns>
        Task<AdminPermissionConfigEntity> GetEntity(long adminPermissionConfigId);
        /// <summary>
        /// 获取员工权限
        /// </summary>
        /// <param name="permissionCode">权限Code</param>
        /// <returns></returns>
        Task<AdminPermissionConfigEntity> GetEntity(string permissionCode);
        /// <summary>
        /// 获取员工权限列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<AdminPermissionConfigEntity>> GetList();
        /// <summary>
        /// 获取未使用的员工权限列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<AdminPermissionConfigEntity>> GetUnusedList();
        /// <summary>
        /// 获取员工权限列表（分页）
        /// </summary>
        /// <param name="permissionName">权限名称</param>
        /// <param name="permissionCode">权限码</param>
        /// <param name="permissionPathCode">权限路径码</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        Task<(IEnumerable<AdminPermissionConfigEntity>, int)> Query(string permissionName, string permissionCode, string permissionPathCode,string sortName,bool? ascending, int pageIndex, int pageSize);
    }
}
